package com.moxiao.yfjh.module.activity.dal.mysql.packageProduct;

import java.util.*;

import com.moxiao.yfjh.framework.common.pojo.PageResult;
import com.moxiao.yfjh.framework.mybatis.core.query.LambdaQueryWrapperX;
import com.moxiao.yfjh.framework.mybatis.core.mapper.BaseMapperX;
import com.moxiao.yfjh.module.activity.dal.dataobject.packageProduct.PackageProductDO;
import org.apache.ibatis.annotations.Mapper;
import com.moxiao.yfjh.module.activity.controller.admin.packageProduct.vo.*;

/**
 * 相亲套餐商品 Mapper
 *
 * @author mx
 */
@Mapper
public interface PackageProductMapper extends BaseMapperX<PackageProductDO> {

    default PageResult<PackageProductDO> selectPage(PackageProductPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<PackageProductDO>()
                .eqIfPresent(PackageProductDO::getProductId, reqVO.getProductId())
                .eqIfPresent(PackageProductDO::getMerchantId, reqVO.getMerchantId())
                .eqIfPresent(PackageProductDO::getCopiesNum, reqVO.getCopiesNum())
                .eqIfPresent(PackageProductDO::getStatus, reqVO.getStatus())
                .betweenIfPresent(PackageProductDO::getCreateTime, reqVO.getCreateTime())
                .eqIfPresent(PackageProductDO::getPackageId, reqVO.getPackageId())
                .orderByDesc(PackageProductDO::getId));
    }

    default List<PackageProductDO> selectList(PackageProductExportReqVO reqVO) {
        return selectList(new LambdaQueryWrapperX<PackageProductDO>()
                .eqIfPresent(PackageProductDO::getProductId, reqVO.getProductId())
                .eqIfPresent(PackageProductDO::getMerchantId, reqVO.getMerchantId())
                .eqIfPresent(PackageProductDO::getCopiesNum, reqVO.getCopiesNum())
                .eqIfPresent(PackageProductDO::getStatus, reqVO.getStatus())
                .betweenIfPresent(PackageProductDO::getCreateTime, reqVO.getCreateTime())
                .eqIfPresent(PackageProductDO::getPackageId, reqVO.getPackageId())
                .orderByDesc(PackageProductDO::getId));
    }

}
